#!/bin/bash

Hadoop_Home='/home/hadoop/cdh5/hadoop/latest'
Cmd_Hadoop="$Hadoop_Home/bin/hadoop"
MapReduce_jar=`ls $Hadoop_Home/share/hadoop/mapreduce/hadoop-mapreduce-client-jobclient-*-tests.jar`

echo -e "Hadoop Home : $Hadoop_Home\nCmd_Hadoop : $Cmd_Hadoop\nMapReduce_jar : $MapReduce_jar\n"

hdfs dfs -rm -r /benchmarks/*
hdfs ec -getPolicy -path /benchmarks
#hdfs ec -setPolicy -path /benchmarks
#hdfs ec -getPolicy -path /benchmarks
######## Hdfs io Test ###########
echo -e "\n\t\033[31mHDFS Read/Write Test (files:10 ,size : 2000MB)\033[0m\n"
$Cmd_Hadoop jar $MapReduce_jar TestDFSIO -write  -nrFiles 10 -size 2000MB
echo -e "\n+++++++++++++++++++++\n"
$Cmd_Hadoop jar $MapReduce_jar TestDFSIO -read  -nrFiles 10 -size 2000MB
echo -e "\n+++++++++++++++++++++\n"
$Cmd_Hadoop jar $MapReduce_jar TestDFSIO -clean

echo -e "\n+++++++++++++++++++++\n"
cat TestDFSIO_results.log
